<html>
<head>
<title>login.ets</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style type="text/css">
.s0 { color: #bbb529;}
.s1 { color: #a9b7c6;}
.s2 { color: #faa23d;}
.s3 { color: #e2da90;}
.s4 { color: #db7e9b;}
.s5 { color: #b3e54c;}
.s6 { color: #aa7dfc;}
</style>
</head>
<body bgcolor="#2b2b2b">
<table CELLSPACING=0 CELLPADDING=5 COLS=1 WIDTH="100%" BGCOLOR="#606060" >
<tr><td><center>
<font face="Arial, Helvetica" color="#000000">
login.ets</font>
</center></td></tr></table>
<pre><span class="s0">@</span><span class="s1">Entry</span>
<span class="s0">@</span><span class="s1">Component</span>
<span class="s1">struct login</span><span class="s2">{</span>
  <span class="s0">@</span><span class="s1">Consume</span>
  <span class="s1">stackPath</span><span class="s3">: </span><span class="s1">NavPathStack</span>
  <span class="s0">@</span><span class="s1">State isAgreed</span><span class="s3">: </span><span class="s1">boolean </span><span class="s3">= </span><span class="s1">false</span><span class="s3">;</span>
  <span class="s1">private showToast</span><span class="s4">(</span><span class="s1">message</span><span class="s3">: </span><span class="s1">string</span><span class="s4">) </span><span class="s2">{</span>
    <span class="s1">this</span><span class="s3">.</span><span class="s1">getUIContext</span><span class="s4">()</span><span class="s3">.</span><span class="s1">getPromptAction</span><span class="s4">()</span><span class="s3">.</span><span class="s1">showToast</span><span class="s4">(</span><span class="s2">{</span>
      <span class="s1">message</span><span class="s3">: </span><span class="s1">message</span><span class="s3">,</span>
      <span class="s1">duration</span><span class="s3">: </span><span class="s5">2000</span>
    <span class="s2">}</span><span class="s4">)</span><span class="s3">;</span>
  <span class="s2">}</span>

  <span class="s1">handleLogin</span><span class="s4">()</span><span class="s2">{</span>
    <span class="s1">if </span><span class="s4">(</span><span class="s3">!</span><span class="s1">this</span><span class="s3">.</span><span class="s1">isAgreed</span><span class="s4">) </span><span class="s2">{</span>
      <span class="s1">this</span><span class="s3">.</span><span class="s1">showToast</span><span class="s4">(</span><span class="s6">&quot;请同意用户协议和隐私政策&quot;</span><span class="s4">)</span><span class="s3">;</span>
      <span class="s1">return</span><span class="s3">;</span>
    <span class="s2">}</span>
    <span class="s1">else </span><span class="s2">{</span>
      <span class="s1">this</span><span class="s3">.</span><span class="s1">stackPath</span><span class="s3">.</span><span class="s1">pushPathByName</span><span class="s4">(</span><span class="s6">'register'</span><span class="s3">,</span><span class="s1">undefined</span><span class="s4">)</span>
    <span class="s2">}</span>
  <span class="s2">}</span>
  <span class="s1">build</span><span class="s4">() </span><span class="s2">{</span>
    <span class="s1">NavDestination</span><span class="s4">()</span><span class="s2">{</span>
      <span class="s1">Column</span><span class="s4">(</span><span class="s2">{</span><span class="s1">space</span><span class="s3">:</span><span class="s5">50</span><span class="s2">}</span><span class="s4">)</span><span class="s2">{</span>
        <span class="s1">Row</span><span class="s4">()</span><span class="s2">{</span>
          <span class="s1">Image</span><span class="s4">(</span><span class="s1">$r</span><span class="s4">(</span><span class="s6">&quot;app.media.return&quot;</span><span class="s4">))</span><span class="s3">.</span><span class="s1">width</span><span class="s4">(</span><span class="s5">20</span><span class="s4">)</span>
          <span class="s1">Text</span><span class="s4">(</span><span class="s6">&quot;帮助&quot;</span><span class="s4">)</span>
            <span class="s3">.</span><span class="s1">fontSize</span><span class="s4">(</span><span class="s5">15</span><span class="s4">)</span>
            <span class="s3">.</span><span class="s1">onClick</span><span class="s4">(()</span><span class="s3">=&gt;</span><span class="s2">{</span>
            <span class="s2">}</span><span class="s4">)</span>
        <span class="s2">}</span><span class="s3">.</span><span class="s1">width</span><span class="s4">(</span><span class="s6">&quot;100%&quot;</span><span class="s4">)</span>
        <span class="s3">.</span><span class="s1">justifyContent</span><span class="s4">(</span><span class="s1">FlexAlign</span><span class="s3">.</span><span class="s1">SpaceBetween</span><span class="s4">)</span>
        <span class="s3">.</span><span class="s1">padding</span><span class="s4">(</span><span class="s5">20</span><span class="s4">)</span>

        <span class="s1">Text</span><span class="s4">(</span><span class="s6">&quot;登录后，体验完整功能&quot;</span><span class="s4">)</span><span class="s3">.</span><span class="s1">fontSize</span><span class="s4">(</span><span class="s5">20</span><span class="s4">)</span>
        <span class="s1">Column</span><span class="s4">(</span><span class="s2">{</span><span class="s1">space</span><span class="s3">:</span><span class="s5">20</span><span class="s2">}</span><span class="s4">) </span><span class="s2">{</span>
          <span class="s1">Image</span><span class="s4">(</span><span class="s1">$r</span><span class="s4">(</span><span class="s6">&quot;app.media.avater&quot;</span><span class="s4">))</span><span class="s3">.</span><span class="s1">width</span><span class="s4">(</span><span class="s5">200</span><span class="s4">)</span>
          <span class="s1">Text</span><span class="s4">(</span><span class="s6">&quot;泅渡&quot;</span><span class="s4">)</span><span class="s3">.</span><span class="s1">fontSize</span><span class="s4">(</span><span class="s5">20</span><span class="s4">)</span>
        <span class="s2">}</span>
        <span class="s1">Column</span><span class="s4">()</span><span class="s2">{</span>
          <span class="s1">Button</span><span class="s4">(</span><span class="s6">&quot;登录/注册&quot;</span><span class="s4">)</span>
            <span class="s3">.</span><span class="s1">fontColor</span><span class="s4">(</span><span class="s6">&quot;FFFFFF&quot;</span><span class="s4">)</span>
            <span class="s3">.</span><span class="s1">backgroundColor</span><span class="s4">(</span><span class="s6">&quot;red&quot;</span><span class="s4">)</span>
            <span class="s3">.</span><span class="s1">width</span><span class="s4">(</span><span class="s6">&quot;87%&quot;</span><span class="s4">)</span>
            <span class="s3">.</span><span class="s1">height</span><span class="s4">(</span><span class="s5">50</span><span class="s4">)</span>
            <span class="s3">.</span><span class="s1">onClick</span><span class="s4">(()</span><span class="s3">=&gt;</span><span class="s2">{</span>
              <span class="s1">this</span><span class="s3">.</span><span class="s1">handleLogin</span><span class="s4">()</span>
            <span class="s2">}</span><span class="s4">)</span>

          <span class="s1">Row</span><span class="s4">() </span><span class="s2">{</span>
            <span class="s1">Checkbox</span><span class="s4">()</span>
              <span class="s3">.</span><span class="s1">select</span><span class="s4">(</span><span class="s1">this</span><span class="s3">.</span><span class="s1">isAgreed</span><span class="s4">)</span>
              <span class="s3">.</span><span class="s1">width</span><span class="s4">(</span><span class="s5">14</span><span class="s4">)</span>
              <span class="s3">.</span><span class="s1">height</span><span class="s4">(</span><span class="s5">14</span><span class="s4">)</span>
              <span class="s3">.</span><span class="s1">onChange</span><span class="s4">(</span><span class="s1">checked </span><span class="s3">=&gt; </span><span class="s2">{</span>
                <span class="s1">this</span><span class="s3">.</span><span class="s1">isAgreed </span><span class="s3">= </span><span class="s1">checked</span><span class="s3">;</span>
              <span class="s2">}</span><span class="s4">)</span>

            <span class="s1">Text</span><span class="s4">(</span><span class="s6">&quot;已阅读并同意&quot;</span><span class="s4">)</span>
              <span class="s3">.</span><span class="s1">fontSize</span><span class="s4">(</span><span class="s5">12</span><span class="s4">)</span>
              <span class="s3">.</span><span class="s1">fontColor</span><span class="s4">(</span><span class="s6">'#888888'</span><span class="s4">)</span>
              <span class="s3">.</span><span class="s1">margin</span><span class="s4">(</span><span class="s2">{ </span><span class="s1">left</span><span class="s3">: </span><span class="s5">5 </span><span class="s2">}</span><span class="s4">)</span>

            <span class="s1">Text</span><span class="s4">(</span><span class="s6">&quot; 用户协议 &quot;</span><span class="s4">)</span>
              <span class="s3">.</span><span class="s1">fontSize</span><span class="s4">(</span><span class="s5">12</span><span class="s4">)</span>
              <span class="s3">.</span><span class="s1">fontColor</span><span class="s4">(</span><span class="s6">'#386BFF'</span><span class="s4">)</span>
              <span class="s3">.</span><span class="s1">onClick</span><span class="s4">(() </span><span class="s3">=&gt; </span><span class="s1">this</span><span class="s3">.</span><span class="s1">showToast</span><span class="s4">(</span><span class="s6">&quot;查看用户协议&quot;</span><span class="s4">))</span>

            <span class="s1">Text</span><span class="s4">(</span><span class="s6">&quot;和&quot;</span><span class="s4">)</span>
              <span class="s3">.</span><span class="s1">fontSize</span><span class="s4">(</span><span class="s5">12</span><span class="s4">)</span>
              <span class="s3">.</span><span class="s1">fontColor</span><span class="s4">(</span><span class="s6">'#888888'</span><span class="s4">)</span>

            <span class="s1">Text</span><span class="s4">(</span><span class="s6">&quot; 隐私政策&quot;</span><span class="s4">)</span>
              <span class="s3">.</span><span class="s1">fontSize</span><span class="s4">(</span><span class="s5">12</span><span class="s4">)</span>
              <span class="s3">.</span><span class="s1">fontColor</span><span class="s4">(</span><span class="s6">'#386BFF'</span><span class="s4">)</span>
              <span class="s3">.</span><span class="s1">onClick</span><span class="s4">(() </span><span class="s3">=&gt; </span><span class="s1">this</span><span class="s3">.</span><span class="s1">showToast</span><span class="s4">(</span><span class="s6">&quot;查看隐私政策&quot;</span><span class="s4">))</span>
          <span class="s2">}</span>
          <span class="s3">.</span><span class="s1">width</span><span class="s4">(</span><span class="s6">'100%'</span><span class="s4">)</span>
          <span class="s3">.</span><span class="s1">justifyContent</span><span class="s4">(</span><span class="s1">FlexAlign</span><span class="s3">.</span><span class="s1">Center</span><span class="s4">)</span>
          <span class="s3">.</span><span class="s1">margin</span><span class="s4">(</span><span class="s2">{ </span><span class="s1">top</span><span class="s3">: </span><span class="s5">20</span><span class="s3">, </span><span class="s1">bottom</span><span class="s3">: </span><span class="s5">30 </span><span class="s2">}</span><span class="s4">)</span>
        <span class="s2">}</span>

      <span class="s2">}</span>
      <span class="s3">.</span><span class="s1">width</span><span class="s4">(</span><span class="s6">&quot;100%&quot;</span><span class="s4">)</span>
      <span class="s3">.</span><span class="s1">height</span><span class="s4">(</span><span class="s6">&quot;100%&quot;</span><span class="s4">)</span>
    <span class="s2">}</span>

  <span class="s2">}</span>
<span class="s2">}</span>

<span class="s0">@</span><span class="s1">Builder</span>
<span class="s1">function buildlogin</span><span class="s4">()</span><span class="s2">{</span>
  <span class="s1">login</span><span class="s4">()</span>
<span class="s2">}</span></pre>
</body>
</html>